<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!-- コンテナをロード -->
  <script type="text/javascript" src="../src/container.js" ></script>
</head>
<body>
  <div id="stdout"></div>
  <script type="text/javascript">
var stdout = document.getElementById( "stdout" );

// クラス
function Kitten() {}
Kitten.prototype = {
   getName: function () { return this.name; }
};

// コンテナを作成。
var c = new container.Container( function( binder ) {
  binder.bind( Kitten ).to( "kitten" ).inject( { "name": "mii" } );
  binder.bind( Kitten ).to( "kitten" ).inject( { "name": "shiro" } );
  binder.bind( Kitten ).to( "kitten" ).inject( { "name": "kuro" } );

  binder.bind( Kitten ).to( "tiger" ).inject( { "name": "tora" } );
});

// コンポーネント定義を列挙
c.eachComponentDef( function( def ) {
  // 引数はコンポーネント定義
  stdout.innerHTML += def[container.Annotation.Container][container.Annotation.Name]
      + " : " + def[container.Annotation.Container][container.Annotation.Inject]["name"] + "<br/>";
});

stdout.innerHTML += "<br/>";

  </script>
</body>
</html>